package com.ycsj.goldmedalnewconcept.teacher.activity;

import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.ycsj.common.base.BaseActivity;
import com.ycsj.goldmedalnewconcept.R;


/**
 * 教师端--红包验证
 * Created by Kevin on 2018/6/26
 */

public class TeacherRedpackageVeriActivity extends BaseActivity implements View.OnClickListener {

    //返回键
    private ImageView ivBack;

    //查询按钮
    private ImageView iv_query;

    //输入框
    private EditText et_tel;

    //标题
    private TextView tv_title;

    @Override
    protected int getContentLayout() {
        return R.layout.teacher_activity_redpackage_veri;
    }

    @Override
    protected void init() {

        initStateBar();

        //初始化视图
        initView();
    }




    /**
     * 初始化视图的方法
     */
    public void initView() {
        ivBack = findViewById(R.id.iv_back);
        ivBack.setOnClickListener(this);
        iv_query = findViewById(R.id.iv_query);
        iv_query.setOnClickListener(this);
        et_tel = findViewById(R.id.et_tel);
        tv_title = findViewById(R.id.tv_title);

        tv_title.setText("验证红包");
    }

    /**
     * 点击事件
     *
     * @param v
     */
    @Override
    public void onClick(View v) {
        int id = v.getId();
        if (id == R.id.iv_back) {
            finish();
        } else if (id == R.id.iv_query) {
            String tel = et_tel.getText().toString().trim();
            if (TextUtils.isEmpty(tel)) {
                Toast.makeText(this, "请输入手机号码", Toast.LENGTH_SHORT).show();
                return;
            }

//            if (!RegularUtils.isMobile(tel)) {
//                Toast.makeText(this, "手机号码格式不正确", Toast.LENGTH_SHORT).show();
//                return;
//            }

            Intent intent = new Intent(this, TeacherRedPackageListActivity.class);
            intent.putExtra("tel", tel);
            startActivity(intent);
        }
    }

}
